﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <h2>Ajax</h2>

    <input type="button" onclick="GetLatLong();" value="Llamada Ajax" />

    <div id="error"></div>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContentPlaceHolder" runat="server">
    <script type="text/javascript" src="<%= ResolveUrl("~") %>Scripts/jquery-1.4.2.min.js"></script>
        
     <script type="text/javascript">         
         function GetLatLong() {
             $.ajax({
                 url: '/Test/GetLatLong',
                 cache: false,
                 data:'id=3',
                 type: 'POST',
                 success: function (data) {
                     alert(data[0] + ' - ' + data[1]);
                 },
                 error: function (XMLHttpRequest, textStatus, errorThrown) {
                     $("#error").html(XMLHttpRequest.responseText);
                 }
             });
         }

         function recuperar() {
             alert("hola");
         }

    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MenuContentPlaceHolder" runat="server">
</asp:Content>
